/*
The MIT License (MIT)

Copyright (c) 2013 Mike Dapiran, Brian May, Richard Pospesel, and Bert Wierenga

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software 
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#pragma once

#define ProcessH(className, humanReadableName)\
	public:\
		HObjectH(className)

#define ProcessCPP(className)\
	HObjectCPP(className)



#include "Hogshead.Common.h"
#include "Hogshead.Core.h"
#include "../EnumConstDeclarations/RenderingBufferUsage.h"
	
namespace Hogshead
{
	namespace DX11Rendering
	{
		class Camera;
		class DX11Director;

		/*
		* This class in an Interface for classes that handle the actual rendering of objects.
		* Multiple instances of these classes can belong to a DX11Director. Each is identified
		* uniquely by its type and name.
		*
		* @see MeshProcess
		* @see DX11Director
		* @see Camera
		*
		* @author Mike Dapiran
		* @author Bert Wierenga
		*/
		class IProcess : public IHObject
		{
		public:
			
			IProcess(void);
			virtual ~IProcess(void);

			/**
			* Called to render all Components registered.
			* 
			* @param in_active_camera the main camera to be used for the rendering pipeline.
			* @param in_nonculled_components the components that the camera culling frustum ran into this frame
			*/
			virtual void render(Camera* in_active_camera, HashSet<void*>* in_nonculled_components) = 0;
			virtual void initialize() = 0;
			virtual void finalize() = 0;
			void setParentDirector( DX11Director* in_parent);

			virtual void registerComponent(IComponent* in_component);
			virtual void unregisterComponent(IComponent* in_component);
			virtual void update(const GameTimer& in_gt);
			virtual IProcess* readXML(const String& in_xml);

			bool enabled() const;

			int handle() const;

			Vector<TEXTURE_BINDING_INFO>& getTextureRequests();
		
		protected:
			ArrayList<IComponent*> _registered_components;

			int _handle;
			bool _enabled;

			DX11Director* _parent;

			/* keeps track of the buffers we want bound and how they should be bound */
			/* name, usage, register */
			Vector<TEXTURE_BINDING_INFO> _texture_buffer_needs;

			bool _culling;
			
		};
	}

}

